package threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolFactory {

    private ThreadPoolFactory() {
    }

    private static class ThreadPoolHolder {
        private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(10, 20,
                3, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1024));
    }

    public static ExecutorService getThreadPool() {
        return ThreadPoolHolder.THREAD_POOL;
    }
}
